<template>
	<view class="content">
		<button class="size" @tap="getCurrentOrientation">获取当前设备的方向信息</button>
		<button class="size" @tap="watchOrientation">监听设备方向信息的变化</button>
		<button class="size" @tap="clearWatch">关闭监听设备方向信息</button>
		<button class="size" @tap="stopVideoCapture">停止摄像</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				watchId:null
			}
		},
		onLoad() {
			
		},
		methods: {
			getCurrentOrientation(){
				plus.orientation.getCurrentOrientation( function ( o ) {
						console.log( "Orientation\nAlpha:" + o.alpha + "\nBeta:" + o.beta + "\nGamma:" + o.gamma );
					} ); 

			},
			watchOrientation(){
				this.watchId = plus.orientation.watchOrientation( function ( o ) {
						console.log( "Orientation\nAlpha:" + o.alpha + "\nBeta:" + o.beta + "\nGamma:" + o.gamma );
					}, function ( e ) {
						console.log( "Orientation error: " + e.message ); 
					} ); 
			},
			clearWatch(){
				plus.orientation.clearWatch( this.watchId );
				this.watchId = null;
			},
			stopVideoCapture(){
				this.cmr.stopVideoCapture();
			}
			
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}

	.logo {
		height: 200rpx;
		width: 200rpx;
		margin-top: 200rpx;
		margin-left: auto;
		margin-right: auto;
		margin-bottom: 50rpx;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
	.size{
		margin:30rpx 0;
	}
</style>
